#!/bin/bash


source mysql_vars.sh

mysql -u root --password=${ROOT_PASSWORD} -e 'drop database IF EXISTS ejabberd'
mysql -u root --password=${ROOT_PASSWORD} -e 'create database IF NOT EXISTS ejabberd'
mysql -u root --password=${ROOT_PASSWORD} -e "grant all on ejabberd.* to 'ejabberd'@'%' identified by '${MYSQL_PASSWORD}'"
mysql -u ejabberd --password=${MYSQL_PASSWORD} ejabberd < /home/mysql.sql